package hoang.hut.networkdemo.network;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class DialogUtils {

	/**
	 * hiển thị thông báo
	 * 
	 * @param context
	 * @param title
	 * @param icon: id của icon, 0 nếu ko muốn hiển thị
	 * @param message
	 * @param positiveButton
	 * @param onClickPositiveButton
	 * @param negativeButton
	 * @param onClickNegativeButton
	 */
	public static void showDialog(Context context, String title, int icon, String message,
			String positiveButton, DialogInterface.OnClickListener onClickPositiveButton,
			String negativeButton, DialogInterface.OnClickListener onClickNegativeButton) {

		AlertDialog.Builder dialog = new AlertDialog.Builder(context);
		if(icon!=0){
			dialog.setIcon(icon);
		}
		dialog.setTitle(title);
		dialog.setMessage(message);

		if (positiveButton != null) {
			dialog.setPositiveButton(positiveButton, onClickPositiveButton);
		}

		if (negativeButton != null) {
			dialog.setNegativeButton(negativeButton, onClickNegativeButton);
		}

		dialog.show();
	}
	
}
